﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
#if DEBUG
using System.Diagnostics;
#endif // #if DEBUG
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using FRL.DebtChased.Silverlight.Library;
using FRL.DebtChased.Silverlight.Library.RichContentService;

namespace FRL.DebtChased.CommBodyEditor
{

	/// <summary>
	/// Declaration of CachedData class
	/// Singleton pattern class for storing supporting data
	/// </summary>
	public class CachedData : CachedDataBase
	{

		/////////////////////////////////////////////////////////////
		// Attributes

		public static CachedData Singleton
		{
			get { return m_SingletonBase as CachedData; }
		}

		private ObservableCollection<CommTemplateTransport> m_commTemplateList = null;
		public ObservableCollection<CommTemplateTransport> CommTemplateList
		{
			get { return m_commTemplateList; }
		}

		/////////////////////////////////////////////////////////////
		// Construction

		static CachedData()
		{

			// Create the single instance
			new CachedData();

		}

		/////////////////////////////////////////////////////////////
		// Operations

		public void AddIncoming(CommBodyEditorSupportData supportData)
		{

			// Process data returned from server

			// Call base-class function
			base.AddIncoming(
				supportData.CurrentUser, 
				null,
				null,
				null,
				null,
				null
			);

			// Get comm templates
			m_commTemplateList = supportData.Templates;
				
		}

		/////////////////////////////////////////////////////////////
		// Static Operations - Fake data used during testing

#if USEFAKEDATA
		public static ClientEditorSupportData GetDummySupportingData()
		{

			// Declare return variable
			ClientEditorSupportData Ftmp = new ClientEditorSupportData();

			// Return variable
			return Ftmp;

		}
#endif // #if USEFAKEDATA

	}

}
